package com.matongxue.dbutils;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * xml很少用了
 */
@Configuration
public class DataSourceConfig {

//    @SneakyThrows
//    @Bean("dataSource1")
//    public DataSource getDataSource1(){
//        ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource();
//        comboPooledDataSource.setDriverClass("com.mysql.jdbc.Driver");
//        comboPooledDataSource.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/testcase?characterEncoding=utf8&useSSL=false");
//        comboPooledDataSource.setUser("root");
//        comboPooledDataSource.setPassword("123456");
//        return  comboPooledDataSource;
//    }
//
//    @SneakyThrows
//    @Bean("dataSource2")
//    public DataSource getDataSource2(){
//        ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource();
//        comboPooledDataSource.setDriverClass("com.mysql.jdbc.Driver");
//        comboPooledDataSource.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/testcase?characterEncoding=utf8&useSSL=false");
//        comboPooledDataSource.setUser("root");
//        comboPooledDataSource.setPassword("123456");
//        return  comboPooledDataSource;
//    }
}
